import java.io.*;
import java.net.URL;
import java.nio.file.*;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;

public class install_maven_wrapper {
    public static void main(String[] args) throws Exception {
        System.out.println("正在下载Maven包装器...");
        
        // 下载maven-wrapper.jar
        URL wrapperUrl = new URL("https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar");
        Path wrapperJarPath = Paths.get(".mvn", "wrapper", "maven-wrapper.jar");
        Files.createDirectories(wrapperJarPath.getParent());
        Files.copy(wrapperUrl.openStream(), wrapperJarPath, StandardCopyOption.REPLACE_EXISTING);
        
        System.out.println("Maven包装器下载成功！");
        
        // 设置mvnw.cmd文件的执行权限
        System.out.println("请确保mvnw.cmd文件可以执行。");
        System.out.println("现在您可以运行：mvnw.cmd clean package -DskipTests");
    }
}